public class Ex4_23{
	public static void main(String[] args){
		final int n = 50000;
		double sum = 0;
		for (int i = 1; i <= n; i++){
			sum += 1.0 / i;
		}
		System.out.println("sum = " + sum);

		sum = 0;
		for (int i = n; i >= 1; i--){
			sum += 1.0 / i;
		}
		System.out.println("sum = " + sum);
	}
}